Add openapi-spec-updated receiver: regenerate the client when a new spec is published - #9
Draft
RichStone wants to merge 1 commit into
Draft
Conversation
Turns the platform's repository_dispatch announcement of a newly published OpenAPI spec into a reviewable draft PR: fetch the spec from the live API, verify the announced SHA-256, run the existing make generate pipeline, sanity-build, and open a draft PR only when the committed generated files changed. Manual runs via workflow_dispatch. Requires OPENAPI_SPEC_URL and OPENAPI_SPEC_TOKEN in the repository's Actions settings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposal to close the spec-to-client sync loop from the platform side.
The ClickFunnels platform publishes its OpenAPI spec at
GET /api/v2/openapi.yamland announces each new artifact to this repository with arepository_dispatchevent of typeopenapi-spec-updated, carrying the spec's SHA-256 inclient_payload.sha256(the same value the endpoint returns in itsX-OpenAPI-SHA256response header). This PR adds the receiving workflow so those announcements turn into reviewable sync PRs here:make generate SPEC_SRC=...(the existing down-convert, normalize, oapi-codegen pipeline),make vet && make test && make build,internal/api/api.gen.go+cmd/operations.gen.gowhen they changed; exit quietly when already in sync (the codegen is deterministic, so the diff itself is the dedupe).Nothing is pushed to
mainand nothing auto-merges; a human reviews every sync PR.workflow_dispatchis included for manual runs with an optional expected checksum.Required repository configuration (values live only in Actions settings, never in the repo)
OPENAPI_SPEC_URL<api base>/api/v2/openapi.yaml)OPENAPI_SPEC_TOKENDraft on purpose: it needs those two values configured by a maintainer, plus a decision on who reviews the sync PRs, before the loop can be exercised end to end.
🤖 Generated with Claude Code